package com.np.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.np.shop.entity.TbBrand;
import com.np.shop.mapper.TbBrandMapper;
import com.np.shop.service.ITbBrandService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 李高帅
 * @since 2020-11-27
 */
@Service
public class TbBrandServiceImpl extends ServiceImpl<TbBrandMapper, TbBrand> implements ITbBrandService {
    @Resource
    private TbBrandMapper tbBrandMapper;

    /**
     * 查询品牌列表
     * @return
     */
    @Override
    public List<TbBrand> findBrand() {
        QueryWrapper<TbBrand> queryWrapper=new QueryWrapper<>();

        return tbBrandMapper.selectList(queryWrapper);
    }

    /**
     * 品牌的回显
     * @param id
     * @return
     */
    @Override
    public TbBrand getBrand(Long id) {
        return tbBrandMapper.selectById(id);
    }

   /* *//**
     * 品牌添加
     * @param tbBrand
     * @return
     *//*
    @Override
    public void addBrand(TbBrand tbBrand) {
        tbBrandMapper.insert(tbBrand);
    }
*/
    /**
     * 品牌的删除 通过id
     * @param id
     */
    @Override
    public void deleteById(long id) {
        tbBrandMapper.deleteById(id);
    }
}
